import type { Meta, StoryObj } from '@storybook/react'
import { action } from '@storybook/addon-actions'
// import Breadcrumbs from '@/components/Breadcrumbs'
import { Breadcrumbs } from '../../lib/index.js'

// More on how to set up stories at: https://storybook.js.org/docs/writing-stories#default-export
const meta = {
  title: 'Ui/Breadcrumbs',
  component: Breadcrumbs,
  parameters: {
    // Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/configure/story-layout
    layout: 'centered',
  },
  // This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs
  tags: ['autodocs'],
  // More on argTypes: https://storybook.js.org/docs/api/argtypes
  argTypes: {
    // backgroundColor: { control: "color" },
  },
  // Use `fn` to spy on the onClick arg, which will appear in the actions panel once invoked: https://storybook.js.org/docs/essentials/actions#action-args
  args: {
    itemClick: action('itemClick:'),
  },
} satisfies Meta<typeof Breadcrumbs>

export default meta
type Story = StoryObj<typeof meta>

// More on writing stories with args: https://storybook.js.org/docs/writing-stories/args
export const Default: Story = {
  args: {
    list: [
      'HD Administration',
      'HD Participant Management',
      'Enrol Participant',
    ],
    itemClick: undefined,
    underline: 'none',
    lastItemClick: false,
    style: undefined,
  },
}
export const BreadcrumbsItemList: Story = {
  args: {
    list: [
      {
        name: 'HD Administration',
        value: 'HD Administration',
      },
      { name: 'HD Participant Management', value: 'HD Participant Management' },
      { name: 'Enrol Participant', value: 'Enrol Participant' },
    ],
    underline: 'none',
    lastItemClick: false,
  },
}

export const WithBackground: Story = {
  args: {
    list: [
      'HD Administration',
      'HD Participant Management',
      'Enrol Participant',
    ],
    itemClick: undefined,
    style: { background: '#f0f0f4' },
  },
}

export const Underline: Story = {
  args: {
    ...Default.args,
    underline: 'always',
  },
}
export const LastItemCanClick: Story = {
  args: {
    ...Default.args,
    itemClick: action('itemClick:'),
    lastItemClick: true,
  },
}
export const WithItemColor: Story = {
  args: {
    ...Default.args,
    list: [
      { name: 'HD Administration', color: 'red' },
      { name: 'HD Participant Management', color: 'blue' },
      { name: 'Enrol Participant', color: 'grey' },
    ],
    itemClick: action('itemClick:'),
    lastItemClick: true,
  },
}
